import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
import {viteMockServe} from 'vite-plugin-mock'


export default defineConfig({
  plugins: [
    vue(),
    viteMockServe({
      // supportTs:false,
      // logger:false,
      mockPath:"./src/mock/api",//解析路径
      localEnabled:true//设置为false,禁用mock
    }),
    Components({
      resolvers: [NaiveUiResolver()]
    })
  ],
  //解决“vite use `--host` to expose”
  base: './',	//不加打包后白屏
  server: {             
    host: '0.0.0.0',	
    // port: 8080,      
    open: true,
  },
  resolve:{   
    //别名配置，引用src路径下的东西可以通过@如：import Layout from '@/layout/index.vue'
    alias:[   
      {
        find:'@',
        replacement:resolve(__dirname,'src') 
      }
    ]
  },
  define: {
    'process.env': {}
  }
  // css: {
  //   postcss: {
  //     plugins: [require("tailwindcss"), require("autoprefixer")]
  //   }
  // }

})
